package com.vf.admin.common.entity;

import com.vf.admin.common.Constants;

public class Result {
    private int code;
    private String msg;
    private Object data;
    private int count;
    private Object page;

    //用于富文本编辑器上传组件
    private int error;//上传结果状态码：0:上传成功  1：上传失败
    private String message;//上传失败描述信息
    private String url;//文件路径

    public static Result successJSON(Object data){
        Result result = new Result();
        result.setCode(Constants.code_return_sucess);
        result.setData(data);
        return result;
    }

    public static Result successJSON(){
        Result result = new Result();
        result.setData("");
        result.setCode(Constants.code_return_sucess);
        result.setMsg("success");
        return result;
    }

    public static Result successJSON(String msg){
        Result result = new Result();
        result.setData("");
        result.setCode(Constants.code_return_sucess);
        result.setMsg(msg);
        return result;
    }

    public static Result errorJSON(String msg){
        Result result = new Result();
        result.setCode(Constants.code_return_error);
        result.setMsg(msg);
        return result;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public int getError() {
        return error;
    }

    public void setError(int error) {
        this.error = error;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Object getPage() {
        return page;
    }

    public void setPage(Object page) {
        this.page = page;
    }
}
